<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<link rel="stylesheet" href="ext-3.0.0/resources/css/ext-all.css" type="text/css" />
<script type="text/javascript" src="ext-3.0.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext-3.0.0/ext-all.js"></script>
<style type="text/css">
.button1 { background: url(resources/button/query.png) no-repeat left center !important;} 
.button2 { background: url(resources/button/export.png) no-repeat left center !important;}  
</style>

<script type="text/javascript">
Ext.onReady(function (){	
	
	var selectType = new Ext.form.ComboBox({
		id: 'deviceType',
       	xtype:"combo",
       	fieldLabel: "设备类型",
        name: 'combo',
        width: 88,
        store: new Ext.data.SimpleStore({
            fields: ['value', 'text'],
            data: [['value1', '载波机'],['value2', 'GPRS',]]
        }),
        displayField: 'text',
        valueField: 'value',
        mode: 'local'
    });

	
	
    
	var button1 = new Ext.Button({ buttonAlign: 'center',
									height: 25,text: '查询',
									iconCls: 'button1',
									handler: function(){
										var time =Ext.get('time').dom.value;
										var deviceType = Ext.get('deviceType').dom.value;
																			
										ds.on('beforeload',function(){ ds.baseParams={ query: "query",deviceType: deviceType,simpleTime: time }; });
										ds.reload({params:{start:0,limit:50}});
									}});
		var button2 = new Ext.Button({  buttonAlign: 'right',height: 25,text: '导出',iconCls: 'button2'   });
									
	
	
	 var form = new Ext.form.FormPanel({       
        frame:true,
        layout: 'fit',
        heigth: 80,
        items: [{
			layout:'column',
            xtype: 'fieldset',            
            title: '查询条件',
            items: [
				{
				layout:'form',
				columnWidth:.2,
				defaultType:'textfield',
				items:[selectType]},button1,button2]
		}]
            
    });

	

	// json数据读取
	
	 var ds = new Ext.data.Store({
		proxy:new Ext.data.HttpProxy({url:"warningHistory.action"}),
		reader: new Ext.data.JsonReader({
			totalProperty : 'results',
			root:'coders',
			idProperty: "ID"},
			[{ name:'resource'},
			 {name:'event'},
			 { name:'frequent'},
			 { name:'firstTime'},
			 {name:'recentTime'},
			 {name:'affirmTime'}])	
	});
	 ds.load(); 
	 
	 	
   

	var panelWarning = new Ext.Panel({
		title: '设备运行状态管理',
        height: 650,
		items:[form]
	});
	
	
	
	var tabs = new Ext.TabPanel({
	    renderTo: Ext.getBody(),
	    activeTab: 0,
	    items: [panelWarning]
	});	
});
</script>    
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查询统计</title>
</head>
<body>
<form id="form" action=""></form>
</body>
</html>
